<template>
  <el-container>
    <el-header>
      <el-row :gutter="24" style="padding-top: 10px">
        <el-col :span="6">
          <el-input v-model="infoQuery.positionName" placeholder="请输入职位名称"/>
        </el-col>
        <el-col :span="6">
          <el-button type="primary" round @click="search">查询</el-button>
          <el-button round @click="resetInfoQuery">重置</el-button>
        </el-col>
      </el-row>
    </el-header>
    <el-main>
      <div>
        <el-table
          :data="tableData"
          border
          style="width: 100%"
        >
          <el-table-column
            prop="positionId"
            label="id"
            width="65"
          />
          <el-table-column
            prop="positionName"
            label="职位名称"
          />
          <el-table-column
            prop="departmentName"
            label="所属部门"
          />
          <el-table-column
            prop="employeesCount"
            label="当前职位总人数"
          />
        </el-table>
      </div>
    </el-main>
  </el-container>
</template>

<script>

import moment from 'moment'
import { getPage, del } from '@/api/info'
import { getDep } from '@/api/dep'
import { getPos,getAllInfo } from '@/api/pos'

export default {
  name: 'Info',
  data() {
    return {
      // 查询条件
      infoQuery: {
        positionName: ''
      },
      // 表格数据
      tableData: [],
      // 部门数据
      depData: [],
      // 职位数据
      posData: []
    }
  },
  watch: {
    $route: {}
  },
  created() {
  },
  mounted() {
    this.init()
  },
  destroyed() {
  },
  methods: {
    init() {
      this.getAllInfo()
    },
    getAllInfo() {
      getAllInfo(this.infoQuery).then(res => {
        this.tableData = res.data
      })
    },
    // 重置查询数据
    resetInfoQuery() {
      this.infoQuery = {
        positionName: ''
      }
      this.getAllInfo()
    },
    // 查询点击事件
    search() {
      this.getAllInfo()
    }
  }
}
</script>

<style lang="scss" scoped>
.el-header, .el-footer {
  background-color: #B3C0D1;
  color: #333;
  //text-align: center;
  //line-height: 60px;
}

.el-main {
  background-color: #E9EEF3;
  color: #333;
  //text-align: center;
  //line-height: 160px;
}
</style>
